package com.farm.service.impl;

import com.farm.dao.CropsIndexMapper;
import com.farm.opjo.CropsIndex;
import com.farm.service.CropsIndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class CropsIndexServiceImpl implements CropsIndexService {
    @Autowired
    private CropsIndexMapper cropsIndexMapper;

    /**
     * 新增
     * @param cropsIndex
     */
    @Override
    public void add(CropsIndex cropsIndex) {
        cropsIndexMapper.insert ( cropsIndex );
    }

    /**
     * 农作物ID删除
     * @param cid
     */
    @Override
    public void deleteByCid(int cid) {
        cropsIndexMapper.deleteByPrimaryKey ( cid );
    }

    /**
     * 农作物ID查询
     * @param cid
     * @return
     */
    @Override
    public CropsIndex findByCId(int cid) {
        return cropsIndexMapper.selectByPrimaryKey ( cid );
    }

    /**
     * 新增
     * @param cropsIndex
     */
    @Override
    public void update(CropsIndex cropsIndex) {
        cropsIndexMapper.updateByPrimaryKey ( cropsIndex );
    }
}
